package org.dromara.business.mapper;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.dromara.business.domain.LzshTemplate;
import org.dromara.business.domain.vo.LzshTemplateVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;

import java.util.List;


/**
 * 比算表Mapper接口
 *
 * @author Lion Li
 * @date 2024-08-21
 */
public interface LzshTemplateMapper extends BaseMapperPlus<LzshTemplate, LzshTemplateVo> {

    @Select("SELECT * FROM lzsh_template WHERE id = #{id}")
    @Results({
        @Result(property = "userInfo", column = "user_info", typeHandler = JacksonTypeHandler.class),
        @Result(property = "plan", column = "plan", typeHandler = JacksonTypeHandler.class)
    })
    LzshTemplateVo queryById(@Param("id") Long id);

    @Select("SELECT * FROM lzsh_template LIMIT #{num},#{size}")
    @Results({
        @Result(property = "userInfo", column = "user_info", typeHandler = JacksonTypeHandler.class),
        @Result(property = "plan", column = "plan", typeHandler = JacksonTypeHandler.class)
    })
    List<LzshTemplateVo> selectAll(@Param("size") int size, @Param("num") int num);

    @Select("SELECT * FROM lzsh_template WHERE title = #{title} LIMIT #{num},#{size}")
    @Results({
        @Result(property = "userInfo", column = "user_info", typeHandler = JacksonTypeHandler.class),
        @Result(property = "plan", column = "plan", typeHandler = JacksonTypeHandler.class)
    })
    List<LzshTemplateVo> selectAllByTitle(@Param("size") int size, @Param("num") int num, @Param("title") String title);

}
